<?php
$rootPath = str_replace('wp-content/themes/wp-foundation/lib/extensions/options-backup', '' ,dirname(__FILE__));
require_once($rootPath . '/wp-config.php');

if (isset($_GET['file']) && isset($_GET['delete'])){
	$filename = $_GET['file'];
	//echo dirname(__FILE__) . '/' . $filename;
	unlink(dirname(__FILE__) . '/' . $filename);
	header("Location: ../../../../../../wp-admin/themes.php?page=theme-options.php&delete=true");
	die;
	
} else if(isset($_GET['file'])){
	$filename = $_GET['file'];
}

$filepath = dirname(__FILE__) . '/' . $filename;

$xml = simplexml_load_file($filepath);
foreach($xml->children() as $child)
  {
$wpdb->update( "$wpdb->options", array('option_value' => "$child->option_value" ), array( 'option_name' => "$child->option_name" )); 
}
header("Location: ../../../../../../wp-admin/themes.php?page=theme-options.php&activate=true");
die;
?>